// const Koa = require('koa');
const Koa = require('./lib/index');
const fs = require('fs');
const path = require('path');   
const app = new Koa();

app.use(async (ctx, next) => {
    // ctx.body = 'ok';
    // res.end('okkk000');
    // console.log(ctx.req.url);
    // console.log(ctx.request.req.url);
    // console.log(ctx.request.path);
    // console.log(ctx.path, ctx.url);
    // ctx.body = '123';
    // ctx.body = Buffer.from('12345');
    // ctx.body = {a: 11, b: 22};
    await next();
    ctx.body = fs.createReadStream(path.resolve(__dirname, 'text.txt'));
})

app.use(async (ctx, next) => {
    console.log('next');
    await next();
})

app.use(async (ctx, next) => {
    console.log('next2');
})


app.listen(3001);